<?xml version="1.0" encoding="UTF-8" ?>
 
<xsl:stylesheet version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns="http://www.w3.org/1999/xhtml">
    <xsl:output method="xml" indent="no"
        doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" 
        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
 
    <!--XHTML document outline--> 
    <xsl:template match="/root">
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru">
            <head>
                <meta name="robots" content="noindex, nofollow" />
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                <link rel="stylesheet" href="design/style.css" type="text/css" />
                <xsl:if test="(/root/dojo) = 1">
                    <link rel="stylesheet" href="http://yandex.st/dojo/1.7.2/dijit/themes/claro/claro.css" />
                    <script type="text/javascript" src="http://yandex.st/dojo/1.7.2/dojo/dojo.js" data-dojo-config="parseOnLoad: true, locale: 'ru'"></script>
                </xsl:if>
                <title></title>
            </head>
            <body class="claro">
                <xsl:call-template name="moduleSelector"/>
                <xsl:apply-templates/>
            </body>
        </html>
    </xsl:template>
    
    <xsl:template name="moduleSelector">
        <div class="moduleSelector">
            <xsl:call-template name="moduleDay"/>
            <xsl:call-template name="moduleSources"/>
            <xsl:call-template name="modulePopularity"/>
            <xsl:call-template name="moduleBrowsers"/>
            <xsl:call-template name="modulePlatforms"/>
            <xsl:call-template name="moduleGeo"/>
            <xsl:call-template name="moduleRobots"/>
        </div>
    </xsl:template>
    
    <xsl:template name="moduleDay">
        <xsl:choose>
            <xsl:when test="/root/module = 'day'">
                <div class="module">Статистика посещений</div>
            </xsl:when>
            <xsl:otherwise>
                <div class="module"><a href="report.php?module=day&amp;report=main&amp;date1={/root/date1}&amp;date2={/root/date2}">Статистика посещений</a></div>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="moduleSources">
        <xsl:choose>
            <xsl:when test="/root/module = 'sources'">
                <div class="module">Источники переходов</div>
            </xsl:when>
            <xsl:otherwise>
                <div class="module"><a href="report.php?module=sources&amp;report=main&amp;date1={/root/date1}&amp;date2={/root/date2}">Источники переходов</a></div>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
 
    <xsl:template name="modulePopularity">
        <xsl:choose>
            <xsl:when test="/root/module = 'popularity'">
                <div class="module">Популярность</div>
            </xsl:when>
            <xsl:otherwise>
                <div class="module"><a href="report.php?module=popularity&amp;report=dirs&amp;date1={/root/date1}&amp;date2={/root/date2}">Популярность</a></div>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="moduleBrowsers">
        <xsl:choose>
            <xsl:when test="/root/module = 'browsers'">
                <div class="module">Браузеры</div>
            </xsl:when>
            <xsl:otherwise>
                <div class="module"><a href="report.php?module=browsers&amp;report=browsers&amp;date1={/root/date1}&amp;date2={/root/date2}">Браузеры</a></div>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="modulePlatforms">
        <xsl:choose>
            <xsl:when test="/root/module = 'platforms'">
                <div class="module">Платформы</div>
            </xsl:when>
            <xsl:otherwise>
                <div class="module"><a href="report.php?module=platforms&amp;report=platforms&amp;date1={/root/date1}&amp;date2={/root/date2}">Платформы</a></div>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="moduleGeo">
        <xsl:choose>
            <xsl:when test="/root/module = 'geo'">
                <div class="module">География</div>
            </xsl:when>
            <xsl:otherwise>
                <div class="module"><a href="report.php?module=geo&amp;report=geo&amp;date1={/root/date1}&amp;date2={/root/date2}">География</a></div>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="moduleRobots">
        <xsl:choose>
            <xsl:when test="/root/module = 'robots'">
                <div class="module">Роботы</div>
            </xsl:when>
            <xsl:otherwise>
                <div class="module"><a href="report.php?module=robots&amp;report=main&amp;date1={/root/date1}&amp;date2={/root/date2}">Роботы</a></div>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    
</xsl:stylesheet>